import request from './ajax'
import mockRequests from './mockAjax'

// 三级联动接口
export const reqCategoryList = () => request({url: '/product/getBaseCategoryList', method: 'get'})

// 获取home首页轮播图的接口
export const reqGetBannerList = () => mockRequests.get('/banner')

// 获取floor数据
export const reqFloorList = () => mockRequests.get('/floor')

// 获取搜索模块的数据 地址:/api/list
/*
{
  "category3Id": "61",
  "categoryName": "手机",
  "keyword": "小米",
  "order": "1:desc",
  "pageNo": 1,
  "pageSize": 10,
  "props": ["1:1700-2799:价格", "2:6.65-6.74英寸:屏幕尺寸"],
  "trademark": "4:小米"
}
 */
export const reqGetSearchInfo = (params) => request({url: '/list', method: 'post', data: params})

//获取产品详情信息
export const reqGoodsInfo = (skuId) => request({url: `/item/${skuId}`, method: 'get'})

//将产品添加到购物车中(获取更新某一个产品的个数)
export const reqAddOrUpdateShopCart = (skuId, skuNum) => request({url: `/cart/addToCart/${skuId}/${skuNum}`, method: 'post'});

//获取购物车列表数据接口
export const reqCartList = () => request({url: '/cart/cartList', method: 'get'})

//删除商品信息
export const reqDeleteCartById = (skuId) => request({url: `/cart/deleteCart/${skuId}`, method: 'delete'})

//修改商品选中状态
export const reqUpdateCheckedById = (skuId, isChecked) => request({url: `/cart/checkCart/${skuId}/${isChecked}`, method: 'get'})

//获取验证码
export const reqGetCode = (phone) => request({url: `/user/passport/sendCode/${phone}`, method: 'get'})

//注册
export const reqUserRegister = (data) => request({url: `/user/passport/register`, data, method: 'post'})

//登录
export const reqUserLogin = (data) => request({url: `/user/passport/login`, data, method: 'post'})
